//C12:12.6:partb.c --external variant.
#include <stdio.h>
extern int count;    // reference declaration, external link

static int total = 0;    // static defination, internal link
void accumulate(int k);
void accumulate(int k)
{
	static int subtotal = 0;   // static ,empty link
	if(k <= 0)
	{
		printf("loop cycle %d\n", count);
		printf("subtotal: %d: total: %d\n", subtotal, total);
		subtotal = 0;
	}
	else
	{
		subtotal += k;
		total += k;
	}
}
